home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.8 KB | 166 lines | [TEXT/GEOL] |
- Item forwarded by N0658 to DTC.AA
-
- Item 9808452 29-March-88 18:29
-
- From: N0658 ESL, Robert Penland, ASC
-
- To: MACAPP$ MacApp Interest List
-
- Sub: MacApp AppleTalk ErrorHandling
-
- I am still twiddling with the appletalk unit of MacApp, I have
- managed to implement the new parameter block calls and get rid of
- the network events, but I am still a little curious about what would
- be the best way to implement the error codes. In the original code,
- as reproduced below, it is stated the with the new UObject error
- mechanism some of the code could be made more efficient. What is
- meant by this and how would one go about doing it? Is the new
- UObject error mechanism the FailNil and FailOSErr calls or the
- Catchfailures/Success procedures? Also to make things better in
- the nodebug case should alerts and dialogs be constructed to handle
- all the current WRITELN statement?
-
-
-
-
-
- FUNCTION OpenAppleTalk: OSErr;
-
- VAR err: OSErr;
-
- BEGIN
-
- WITH gStartStatus DO
-
- BEGIN
-
- theErr := noErr; {??? can dispense with this if we supplant
-
- the error-handling mechanism used}
-
- theSeqNum := 0; { in this unit with the new UObject error
-
- mechanism}
-
- END;
-
-
-
- err := MPPOpen; {Open the AppleTalk driver}
-
- IF err = noErr THEN
-
- BEGIN
-
- err := GetNodeAddress(gNode, gNet);
-
- {$IFC qDebug}
-
- IF err = noMPPErr THEN
-
- {??? Need better handling, especially in nondebug case}
-
- WRITELN('MPPDriver not installed')
-
- ELSE
-
- IF err <> noErr THEN
-
- {??? Need reasonable response}
-
- WriteLn('Error from MPPOpen is: ', err:1)
-
- ELSE
-
- IF gExperimenting THEN
-
- WriteLn('gNode = ', gNode:1, '; gNet = ', gNet:1);
-
- {$ENDC}
-
- END
-
- ELSE
-
- {$IFC qDebug}
-
- {??? Need reasonable response}
-
- WRITELN('AppleTalk not installed')
-
- {$ENDC}
-
- ; {This semicolon intentionally alone on this line}
-
-
-
- {$IFC qDebug}
-
- gDebugNetwork := FALSE;
-
-
-
- gTraceAppleTalkCalls[preCall] := FALSE;
-
- gTraceAppleTalkCalls[postCall] := FALSE;
-
- gTraceAppleTalkCalls[postCompletion] := FALSE;
-
- {$ENDC}
-
- gOKAppleTalk := (err = noErr);
-
- OpenAppleTalk := err;
-
- END;
-
-
-
- Here is the suggestion to supplant with new error mechanism again.
- What is meant by this and what would the new code look like?
-
-
-
- FUNCTION CheckForError(anErrStatus: ErrStatus): BOOLEAN;
-
- {??? Supplant with new error mechanism?}
-
- BEGIN
-
- WITH anErrStatus DO
-
- IF theErr <> noErr THEN
-
- BEGIN
-
- {$IFC qDebug}
-
- WriteLn('Err: ', theErr:1, ' at SeqNum ', theSeqNum:1, '.');
-
- ProgramBreak('Error in CheckForError');
-
- {$ENDC}
-
- CheckForError := TRUE;
-
- END
-
- ELSE
-
- CheckForError := FALSE;
-
- END;
-
-
-
- I would appreciate any feedback you could provide.
-
-
-
- Thanks,
-
- Robert Penland
-
-
-
-